package com.itheima.health.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration //这个注解是spring 框架提供 只要在一个普通类上加上这个注解 那么这个类就是一个配置类
@Slf4j

public class WebMvcConfig extends WebMvcConfigurationSupport {
    /*
    设置静态资源映射
    @param registry
     */

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        //配置静态资源映射 addResourceHandler 设置拦截的url请求
        registry.addResourceHandler("/backend/**").addResourceLocations("classpath:/backend/");
        registry.addResourceHandler("/front/**").addResourceLocations("classpath:/front/");
        log.info("WebMvcConfig.addResourceHandlers");
    }
}
